// pinia用户使用方法
import { defineStore } from 'pinia'
export const userStore = defineStore('user',{
    // 数据
    state:() =>{
        return{
            token:localStorage.getItem('token') || '',
            userinfo:localStorage.getItem('userInfo') || {}
        }
    },
    // 方法
    actions:{
        setUserInfo(data: any){
            this.token = data.token
            this.userinfo = data.user_info
            localStorage.setItem('token',this.token)
            localStorage.setItem('userInfo',JSON.stringify(this.userinfo))
        }
    }
})
